﻿<script language="javascript" type="text/javascript">
    var _SendToFriendJobID = 0;
    function ConfirmSendToFriend(jobID, btn) {
        if (_SendToFriendJobID != jobID)
            $('#divServerMessage').html('');
        _SendToFriendJobID = jobID;
        $('#divSendToFriendDialog').modal({ show: true });
    }
    function SendToFriend() {
        if ($('#frmSendToFriend').valid()) {
            ShowLoadingAnimation(false);
            Ajax('@Url.PublicUrl("SendJobToFriend", "Ajax")', 'JobID=' + _SendToFriendJobID + '&UserEmail=' + $('#YourEmail').val() + '&FriendEmail=' + $('#FriendEmail').val(), function (result) {
                HideLoadingAnimation();
                var status = parseInt(result);
                var html = '';
                if (status == 1) {
                    html = SuccessMessageBox('Congratulations! The job sent successfully to your friend.');
                    $('#FriendEmail').val('');
                }
                else
                    html = WarningMessageBox('Sorry! something went wrong, we could not send the job to your friend. Please try after some time.');
                $('#divServerMessage').html(html);

            });
        }
    }
</script>